package com.zjuee.web.ledger.service.impl.handledata;

import com.zjuee.core.translation.handledata.impl.AbstractDataHandler;
import com.zjuee.vo.PlanSolidVo;
import com.zjuee.base.model.common.plan.PlanSolid;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component(value = "planSolidHandle")
public class PlanSolidHandle extends AbstractDataHandler {
    @Override
    public <T> T getData(T data, Map<Object, Object> map, String... str) {
        PlanSolid planSolid = (PlanSolid) data;
        PlanSolidVo planSolidVo = new PlanSolidVo();
        BeanUtils.copyProperties(planSolid, planSolidVo);
        planSolidVo.setWpsName(map.get(planSolid.getWpsCode() + "" + str[0]) == null ? "" : map.get(planSolid.getWpsCode() + "" + str[0]).toString());
        planSolidVo.setWpsPropertyStr(map.get(planSolid.getWpsProperty() + "" + str[1]) == null ? "" : map.get(planSolid.getWpsProperty() + "" + str[1]).toString());
        return (T) planSolidVo;
    }
}
